<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>webdoc</title>
    <link rel="stylesheet" type="text/css" href="../static/css/main.css">
</head>
<body>
<div class="nav">
    <div class="logo">
        
            webdoc
        
    </div>
<ul><li><a href="../index.html">0.Async</a></li><li><a href="../html/0.editor.html">0.editor</a></li><li><a href="../html/0.module.html">0.module</a></li><li><a href="../html/1.ES2015.html">1.ES2015</a></li><li><a href="../html/2.Promise.html">2.Promise</a></li><li><a href="../html/3.Node.html">3.Node</a></li><li><a href="../html/4.NodeInstall.html">4.NodeInstall</a></li><li><a href="../html/5.REPL.html">5.REPL</a></li><li><a href="../html/6.NodeCore.html">6.NodeCore</a></li><li><a href="../html/7.module&NPM.html">7.module&NPM</a></li><li><a href="../html/8.Encoding.html">8.Encoding</a></li><li><a href="../html/9.Buffer.html">9.Buffer</a></li><li><a href="../html/10.fs.html">10.fs</a></li><li><a href="../html/11.Stream-1.html">11.Stream-1</a></li><li><a href="../html/11.Stream-2.html">11.Stream-2</a></li><li><a href="../html/11.Stream-3.html">11.Stream-3</a></li><li><a href="../html/11.Stream-4.html">11.Stream-4</a></li><li><a href="../html/12-Network-2.html">12-Network-2</a></li><li class="active"><a href="../html/12.NetWork-3.html">12.NetWork-3</a></li><li><a href="../html/12.Network-1.html">12.Network-1</a></li><li><a href="../html/13.tcp.html">13.tcp</a></li><li><a href="../html/14.http-1.html">14.http-1</a></li><li><a href="../html/14.http-2.html">14.http-2</a></li><li><a href="../html/15.compress.html">15.compress</a></li><li><a href="../html/16.crypto.html">16.crypto</a></li><li><a href="../html/17.process.html">17.process</a></li><li><a href="../html/18.yargs.html">18.yargs</a></li><li><a href="../html/19.cache.html">19.cache</a></li><li><a href="../html/20.action.html">20.action</a></li><li><a href="../html/21.https.html">21.https</a></li><li><a href="../html/22.cookie.html">22.cookie</a></li><li><a href="../html/23.session.html">23.session</a></li><li><a href="../html/24.express-1.html">24.express-1</a></li><li><a href="../html/24.express-2.html">24.express-2</a></li><li><a href="../html/24.express-3.html">24.express-3</a></li><li><a href="../html/24.express-4.html">24.express-4</a></li><li><a href="../html/25.koa-1.html">25.koa-1</a></li><li><a href="../html/26.webpack-1-basic.html">26.webpack-1-basic</a></li><li><a href="../html/26.webpack-2-optimize.html">26.webpack-2-optimize</a></li><li><a href="../html/26.webpack-3.tapable.html">26.webpack-3.tapable</a></li><li><a href="../html/26.webpack-4-AST.html">26.webpack-4-AST</a></li><li><a href="../html/26.webpack-5-source.html">26.webpack-5-source</a></li><li><a href="../html/26.webpack-6-loader.html">26.webpack-6-loader</a></li><li><a href="../html/26.webpack-7-plugin.html">26.webpack-7-plugin</a></li><li><a href="../html/26.webpack-8-hand.html">26.webpack-8-hand</a></li><li><a href="../html/27.react-1.html">27.react-1</a></li><li><a href="../html/27.react-2.html">27.react-2</a></li><li><a href="../html/27.react-3.html">27.react-3</a></li><li><a href="../html/27.react-4-immutable.html">27.react-4-immutable</a></li><li><a href="../html/27.react-5-react-dom-diff.html">27.react-5-react-dom-diff</a></li><li><a href="../html/27.react-6.html">27.react-6</a></li><li><a href="../html/28.react-mobx.html">28.react-mobx</a></li><li><a href="../html/28.redux-0.html">28.redux-0</a></li><li><a href="../html/28.redux-1.html">28.redux-1</a></li><li><a href="../html/28.redux-2-中间件.html">28.redux-2-中间件</a></li><li><a href="../html/28.redux-3-saga.html">28.redux-3-saga</a></li><li><a href="../html/28.redux-jwt-back.html">28.redux-jwt-back</a></li><li><a href="../html/28.redux-jwt-front.html">28.redux-jwt-front</a></li><li><a href="../html/29.mongodb-1.html">29.mongodb-1</a></li><li><a href="../html/29.mongodb-2.html">29.mongodb-2</a></li><li><a href="../html/29.mongodb-3.html">29.mongodb-3</a></li><li><a href="../html/29.mongodb-4.html">29.mongodb-4</a></li><li><a href="../html/29.mongodb-5.html">29.mongodb-5</a></li><li><a href="../html/29.mongodb-6.html">29.mongodb-6</a></li><li><a href="../html/30.cms-1-mysql.html">30.cms-1-mysql</a></li><li><a href="../html/30.cms-2-mysql.html">30.cms-2-mysql</a></li><li><a href="../html/30.cms-3-mysql.html">30.cms-3-mysql</a></li><li><a href="../html/30.cms-4-egg.html">30.cms-4-egg</a></li><li><a href="../html/30.cms-5-api.html">30.cms-5-api</a></li><li><a href="../html/30.cms-6-roadhog.html">30.cms-6-roadhog</a></li><li><a href="../html/30.cms-7-umi.html">30.cms-7-umi</a></li><li><a href="../html/30.cms-8-dva.html">30.cms-8-dva</a></li><li><a href="../html/30.cms-9-dva.html">30.cms-9-dva</a></li><li><a href="../html/30.cms-10-dva.html">30.cms-10-dva</a></li><li><a href="../html/30.cms-11-front.html">30.cms-11-front</a></li><li><a href="../html/31.cms-12-api.html">31.cms-12-api</a></li><li><a href="../html/31.cms-13-front.html">31.cms-13-front</a></li><li><a href="../html/31.cms-14-deploy.html">31.cms-14-deploy</a></li><li><a href="../html/32.ant.html">32.ant</a></li><li><a href="../html/33.redis.html">33.redis</a></li><li><a href="../html/34.unittest.html">34.unittest</a></li><li><a href="../html/35.jwt.html">35.jwt</a></li><li><a href="../html/36.websocket-1.html">36.websocket-1</a></li><li><a href="../html/36.websocket-2.html">36.websocket-2</a></li><li><a href="../html/38.chat-api-1.html">38.chat-api-1</a></li><li><a href="../html/38.chat-api-2.html">38.chat-api-2</a></li><li><a href="../html/38.chat-3.html">38.chat-3</a></li><li><a href="../html/38.chat-api-3.html">38.chat-api-3</a></li><li><a href="../html/38.chat.html">38.chat</a></li><li><a href="../html/38.chat2.html">38.chat2</a></li><li><a href="../html/38.chat2.html">38.chat2</a></li><li><a href="../html/39.crawl-0.html">39.crawl-0</a></li><li><a href="../html/39.crawl-1.html">39.crawl-1</a></li><li><a href="../html/39.crawl-2.html">39.crawl-2</a></li><li><a href="../html/40.deploy.html">40.deploy</a></li><li><a href="../html/41.safe.html">41.safe</a></li><li><a href="../html/42.test.html">42.test</a></li><li><a href="../html/43.nginx.html">43.nginx</a></li><li><a href="../html/44.enzyme.html">44.enzyme</a></li><li><a href="../html/45.docker.html">45.docker</a></li><li><a href="../html/46.elastic.html">46.elastic</a></li><li><a href="../html/47.oauth.html">47.oauth</a></li><li><a href="../html/48.wxpay.html">48.wxpay</a></li><li><a href="../html/49.nunjucks.html">49.nunjucks</a></li><li><a href="../html/50.ketang.html">50.ketang</a></li><li><a href="../html/index.html">index</a></li><li><a href="../html/51.typescript.html">51.typescript</a></li><li><a href="../html/52.UML.html">52.UML</a></li><li><a href="../html/53.design.html">53.design</a></li><li><a href="../html/index.html">index</a></li></ul></div>


<div class="warpper">

    <div class="page-toc">
        <ul><li><a href="#t01. wireshark有什么用">1. wireshark有什么用</a></li><li><a href="#t12. 安装">2. 安装</a></li><li><a href="#t23. 快速抓包">3. 快速抓包</a></li><li><a href="#t34. 界面">4. 界面</a></li><li><a href="#t45. 过滤器设置">5. 过滤器设置</a><ul><li><a href="#t55.1 抓包过滤器">5.1 抓包过滤器</a><ul><li><a href="#t65.1.1 语法">5.1.1 语法</a></li><li><a href="#t75.1.2 例子">5.1.2 例子</a><ul><li><a href="#t85.1.2.1 过滤MAC">5.1.2.1 过滤MAC</a></li><li><a href="#t95.1.2.2 过滤IP">5.1.2.2 过滤IP</a></li><li><a href="#t105.1.2.3 过滤端口">5.1.2.3 过滤端口</a></li><li><a href="#t115.1.2.4 过滤协议">5.1.2.4 过滤协议</a></li><li><a href="#t125.1.2.5 综合过滤">5.1.2.5 综合过滤</a></li></ul></li></ul></li><li><a href="#t135.2 显示过滤器">5.2 显示过滤器</a><ul><li><a href="#t145.2.1 语法">5.2.1 语法</a></li><li><a href="#t155.2.2 案例">5.2.2 案例</a><ul><li><a href="#t165.2.2.1 过滤IP">5.2.2.1 过滤IP</a></li><li><a href="#t175.2.2.2 过滤端口">5.2.2.2 过滤端口</a></li><li><a href="#t185.2.2.3 过滤协议">5.2.2.3 过滤协议</a></li><li><a href="#t195.2.2.4 案例">5.2.2.4 案例</a></li></ul></li></ul></li></ul></li><li><a href="#t206. 三次握手">6. 三次握手</a><ul><li><a href="#t217. Wireshark与对应的OSI七层模型">7. Wireshark与对应的OSI七层模型</a></li><li><a href="#t22TCP包具体内容">TCP包具体内容</a></li><li><a href="#t238.参考">8.参考</a></li></ul></li></ul>
    </div>
    
    <div class="content markdown-body">
        <h2 id="t01. wireshark&#x6709;&#x4EC0;&#x4E48;&#x7528;">1. wireshark&#x6709;&#x4EC0;&#x4E48;&#x7528; <a href="#t01. wireshark&#x6709;&#x4EC0;&#x4E48;&#x7528;"> # </a></h2>
<ol>
<li>&#x5206;&#x6790;&#x7F51;&#x7EDC;&#x5E95;&#x5C42;&#x534F;&#x8BAE;</li>
<li>&#x89E3;&#x51B3;&#x7F51;&#x7EDC;&#x6545;&#x969C;&#x95EE;&#x9898;</li>
<li>&#x627E;&#x5BFB;&#x7F51;&#x7EDC;&#x5B89;&#x5168;&#x95EE;&#x9898;</li>
</ol>
<h2 id="t12. &#x5B89;&#x88C5;">2. &#x5B89;&#x88C5; <a href="#t12. &#x5B89;&#x88C5;"> # </a></h2>
<ul>
<li><a href="https://www.wireshark.org/download.html">download</a></li>
<li><a href="http://wiresharkbook.com/">wiresharkbook</a></li>
</ul>
<h2 id="t23. &#x5FEB;&#x901F;&#x6293;&#x5305;">3. &#x5FEB;&#x901F;&#x6293;&#x5305; <a href="#t23. &#x5FEB;&#x901F;&#x6293;&#x5305;"> # </a></h2>
<ul>
<li>&#x521D;&#x59CB;&#x5316;&#x754C;&#x9762;</li>
<li>&#x9009;&#x62E9;&#x7F51;&#x5361;</li>
<li>&#x505C;&#x6B62;&#x6293;&#x5305;</li>
<li>&#x4FDD;&#x5B58;&#x6570;&#x636E;&#x5305;</li>
</ul>
<h2 id="t34. &#x754C;&#x9762;">4. &#x754C;&#x9762; <a href="#t34. &#x754C;&#x9762;"> # </a></h2>
<p><img src="http://img.zhufengpeixun.cn/wiresharklayout.png" alt="&#x6293;&#x5305;&#x8FC7;&#x6EE4;&#x5668;"></p>
<ul>
<li>&#x6807;&#x9898;&#x680F;</li>
<li>&#x4E3B;&#x83DC;&#x5355;&#x680F;</li>
<li>&#x5DE5;&#x5177;&#x680F;</li>
<li>&#x6570;&#x636E;&#x5305;&#x8FC7;&#x6EE4;&#x680F;</li>
<li>&#x6570;&#x636E;&#x5305;&#x5217;&#x8868;&#x533A;</li>
<li>&#x6570;&#x636E;&#x5305;&#x8BE6;&#x7EC6;&#x533A;</li>
<li>&#x6570;&#x636E;&#x5305;&#x5B57;&#x8282;&#x533A;</li>
<li>&#x6570;&#x636E;&#x5305;&#x7EDF;&#x8BA1;&#x533A;</li>
</ul>
<h2 id="t45. &#x8FC7;&#x6EE4;&#x5668;&#x8BBE;&#x7F6E;">5. &#x8FC7;&#x6EE4;&#x5668;&#x8BBE;&#x7F6E; <a href="#t45. &#x8FC7;&#x6EE4;&#x5668;&#x8BBE;&#x7F6E;"> # </a></h2>
<h3 id="t55.1 &#x6293;&#x5305;&#x8FC7;&#x6EE4;&#x5668;">5.1 &#x6293;&#x5305;&#x8FC7;&#x6EE4;&#x5668; <a href="#t55.1 &#x6293;&#x5305;&#x8FC7;&#x6EE4;&#x5668;"> # </a></h3>
<p><img src="http://img.zhufengpeixun.cn/wireshareprotocal.jpg" alt="&#x6293;&#x5305;&#x8FC7;&#x6EE4;&#x5668;"></p>
<h4 id="t65.1.1 &#x8BED;&#x6CD5;">5.1.1 &#x8BED;&#x6CD5; <a href="#t65.1.1 &#x8BED;&#x6CD5;"> # </a></h4>
<p>&#x534F;&#x8BAE;+&#x65B9;&#x5411;+&#x7C7B;&#x578B;+&#x503C;</p>
<ul>
<li>HOST net port host</li>
<li>&#x65B9;&#x5411; src&#x3001;dst&#x3001;src and dst&#x3001;src or dst</li>
<li>&#x534F;&#x8BAE;  ether ip tcp udp http ftp</li>
<li>&#x903B;&#x8F91;&#x8FD0;&#x7B97;&#x7B26; &amp;&amp; || !</li>
</ul>
<h4 id="t75.1.2 &#x4F8B;&#x5B50;">5.1.2 &#x4F8B;&#x5B50; <a href="#t75.1.2 &#x4F8B;&#x5B50;"> # </a></h4>
<ul>
<li>src host 192.168.1.1 &amp;&amp; dst port 80 &#x6293;&#x53D6;&#x6765;&#x6E90;&#x5730;&#x5740;&#x4E3A;192.168.1.1&#xFF0C;&#x5E76;&#x4E14;&#x76EE;&#x7684;&#x4E3A;80&#x7AEF;&#x53E3;&#x7684;&#x6D41;&#x91CF;</li>
<li>host  192.168.1.1|| host host 192.168.1.2 &#x6293;&#x53D6;192.168.1.1&#x6216;192.168.1.2&#x7684;&#x6D41;&#x91CF;</li>
<li>!broadcast &#x4E0D;&#x6293;&#x53D6;&#x5E7F;&#x64AD;&#x5305;</li>
</ul>
<h5 id="t85.1.2.1 &#x8FC7;&#x6EE4;MAC">5.1.2.1 &#x8FC7;&#x6EE4;MAC <a href="#t85.1.2.1 &#x8FC7;&#x6EE4;MAC"> # </a></h5>
<ul>
<li>ether host 00:00:00:00:00:00  &#x7F51;&#x5361;&#x4E3B;&#x673A;</li>
<li>ether src  host 00:00:00:00:00:00 &#x6765;&#x6E90;MAC</li>
<li>ether dst  host 00:00:00:00:00:00 &#x76EE;&#x6807;MAC</li>
</ul>
<h5 id="t95.1.2.2 &#x8FC7;&#x6EE4;IP">5.1.2.2 &#x8FC7;&#x6EE4;IP <a href="#t95.1.2.2 &#x8FC7;&#x6EE4;IP"> # </a></h5>
<ul>
<li>host 192.168.1.1</li>
<li>src host 192.168.1.1</li>
<li>det host 192.168.1.1</li>
</ul>
<h5 id="t105.1.2.3 &#x8FC7;&#x6EE4;&#x7AEF;&#x53E3;">5.1.2.3 &#x8FC7;&#x6EE4;&#x7AEF;&#x53E3; <a href="#t105.1.2.3 &#x8FC7;&#x6EE4;&#x7AEF;&#x53E3;"> # </a></h5>
<ul>
<li>port 80</li>
<li>!port 80</li>
<li>dst port 80</li>
<li>src port 80</li>
</ul>
<h5 id="t115.1.2.4 &#x8FC7;&#x6EE4;&#x534F;&#x8BAE;">5.1.2.4 &#x8FC7;&#x6EE4;&#x534F;&#x8BAE; <a href="#t115.1.2.4 &#x8FC7;&#x6EE4;&#x534F;&#x8BAE;"> # </a></h5>
<ul>
<li>arp</li>
<li>tcp</li>
</ul>
<h5 id="t125.1.2.5 &#x7EFC;&#x5408;&#x8FC7;&#x6EE4;">5.1.2.5 &#x7EFC;&#x5408;&#x8FC7;&#x6EE4; <a href="#t125.1.2.5 &#x7EFC;&#x5408;&#x8FC7;&#x6EE4;"> # </a></h5>
<ul>
<li>host 192.168.1.100 &amp;&amp; port 8080</li>
</ul>
<h3 id="t135.2 &#x663E;&#x793A;&#x8FC7;&#x6EE4;&#x5668;">5.2 &#x663E;&#x793A;&#x8FC7;&#x6EE4;&#x5668; <a href="#t135.2 &#x663E;&#x793A;&#x8FC7;&#x6EE4;&#x5668;"> # </a></h3>
<p>&#x663E;&#x793A;&#x8FC7;&#x6EE4;&#x5668;&#xFF1A;&#x5BF9;&#x6355;&#x6349;&#x5230;&#x7684;&#x6570;&#x636E;&#x5305;&#x4F9D;&#x636E;&#x534F;&#x8BAE;&#x6216;&#x5305;&#x7684;&#x5185;&#x5BB9;&#x8FDB;&#x884C;&#x8FC7;&#x6EE4;
<img src="http://img.zhufengpeixun.cn/wireshareshow.jpg" alt="&#x6293;&#x5305;&#x8FC7;&#x6EE4;&#x5668;"></p>
<h4 id="t145.2.1 &#x8BED;&#x6CD5;">5.2.1 &#x8BED;&#x6CD5; <a href="#t145.2.1 &#x8BED;&#x6CD5;"> # </a></h4>
<ul>
<li>&#x6BD4;&#x8F83;&#x64CD;&#x4F5C;&#x7B26; == != &gt; &lt; &gt;= &lt;=</li>
<li>&#x903B;&#x8F91;&#x64CD;&#x4F5C;&#x7B26; and or xor(&#x6709;&#x4E14;&#x4EC5;&#x6709;&#x4E00;&#x4E2A;&#x6761;&#x4EF6;&#x88AB;&#x6EE1;&#x8DB3;) not</li>
<li>IP&#x5730;&#x5740; ip addr ip.src ip.dst</li>
<li>&#x7AEF;&#x53E3;&#x8FC7;&#x6EE4; tcp.port tcp.srcport tcp.dstport tcp.flags.syn tcp.flag.ack</li>
<li>&#x534F;&#x8BAE;&#x8FC7;&#x6EE4; arp ip icmp udp tcp bootp dns<h4 id="t155.2.2 &#x6848;&#x4F8B;">5.2.2 &#x6848;&#x4F8B; <a href="#t155.2.2 &#x6848;&#x4F8B;"> # </a></h4>
<h5 id="t165.2.2.1 &#x8FC7;&#x6EE4;IP">5.2.2.1 &#x8FC7;&#x6EE4;IP <a href="#t165.2.2.1 &#x8FC7;&#x6EE4;IP"> # </a></h5>
</li>
<li>ip.addr == 192.168.0.1</li>
<li>ip.src == 192.168.0.1</li>
<li>ip.dst == 192.168.0.1</li>
<li>ip.src == 192.168.0.1 and ip.dst == 192.168.0.1</li>
</ul>
<h5 id="t175.2.2.2 &#x8FC7;&#x6EE4;&#x7AEF;&#x53E3;">5.2.2.2 &#x8FC7;&#x6EE4;&#x7AEF;&#x53E3; <a href="#t175.2.2.2 &#x8FC7;&#x6EE4;&#x7AEF;&#x53E3;"> # </a></h5>
<ul>
<li>tcp.port == 80</li>
<li>tcp.srcport == 80</li>
<li>tcp.dstport == 80</li>
<li>tcp.flags.sync == 1</li>
</ul>
<h5 id="t185.2.2.3 &#x8FC7;&#x6EE4;&#x534F;&#x8BAE;">5.2.2.3 &#x8FC7;&#x6EE4;&#x534F;&#x8BAE; <a href="#t185.2.2.3 &#x8FC7;&#x6EE4;&#x534F;&#x8BAE;"> # </a></h5>
<ul>
<li>arp</li>
<li>tcp</li>
<li>udp</li>
<li>not http</li>
<li>not arp</li>
</ul>
<h5 id="t195.2.2.4 &#x6848;&#x4F8B;">5.2.2.4 &#x6848;&#x4F8B; <a href="#t195.2.2.4 &#x6848;&#x4F8B;"> # </a></h5>
<ul>
<li>ip.src == 192.168.0.1 and tcp.dstport == 80</li>
<li>ip.addr == 192.168.0.1 and udp.port == 60000</li>
</ul>
<h2 id="t206. &#x4E09;&#x6B21;&#x63E1;&#x624B;">6. &#x4E09;&#x6B21;&#x63E1;&#x624B; <a href="#t206. &#x4E09;&#x6B21;&#x63E1;&#x624B;"> # </a></h2>
<p><img src="http://img.zhufengpeixun.cn/tcpconnect.png" alt="&#x6293;&#x5305;&#x8FC7;&#x6EE4;&#x5668;"></p>
<h3 id="t217. Wireshark&#x4E0E;&#x5BF9;&#x5E94;&#x7684;OSI&#x4E03;&#x5C42;&#x6A21;&#x578B;">7. Wireshark&#x4E0E;&#x5BF9;&#x5E94;&#x7684;OSI&#x4E03;&#x5C42;&#x6A21;&#x578B; <a href="#t217. Wireshark&#x4E0E;&#x5BF9;&#x5E94;&#x7684;OSI&#x4E03;&#x5C42;&#x6A21;&#x578B;"> # </a></h3>
<p><img src="http://img.zhufengpeixun.cn/Wiresharkseven.jpg" alt="Wiresharkseven"></p>
<h3 id="t22TCP&#x5305;&#x5177;&#x4F53;&#x5185;&#x5BB9;">TCP&#x5305;&#x5177;&#x4F53;&#x5185;&#x5BB9; <a href="#t22TCP&#x5305;&#x5177;&#x4F53;&#x5185;&#x5BB9;"> # </a></h3>
<p><img src="http://img.zhufengpeixun.cn/tcpinfo.jpg" alt="tcpinfo"></p>
<h3 id="t238.&#x53C2;&#x8003;">8.&#x53C2;&#x8003; <a href="#t238.&#x53C2;&#x8003;"> # </a></h3>
<ul>
<li><a href="https://www.cnblogs.com/TankXiao/archive/2012/10/10/2711777.html">wireshark</a></li>
</ul>

        <div class="copyright">Powered by <a href="https://github.com/jaywcjlove/idoc" target="_blank">idoc</a>. Dependence <a href="https://nodejs.org">Node.js</a> run.</div>
    </div>
    
</div>

<script src="https://cdn.bootcss.com/jquery/3.0.0/jquery.js"></script>
<script>
$('.warpper .page-toc ul ul li a').on('click',function(){
  $('.warpper .page-toc ul ul li a').removeClass('my-active')
  $(this).addClass('my-active')
})
  // if (!$('.understand-me').length) {
  //   var bar = $(window).height() - $('.navbar ').height() - $('.page-toc').position().top;
  //   var count = bar / 26 / 2;
  //   var barHeight = $('.page-toc').outerHeight();
  //   $('.page-toc li').eq(0).children('a').addClass('red');
  //   var arr = [];
  //   $("h1,h2,h3,h4,h5,h6").each(function () {
  //     arr.push($(this).position().top);
  //   });
  //   var timer
  //   function dark() {
  //     clearTimeout(timer)
  //      timer = setTimeout(function () {
  //      var top = Math.abs($('.page-toc > ul').position().top);
  //      var cur = $('.content').scrollTop();
  //      for (var i = arr.length; i >= 0; i--) {
  //        if (arr[i] <= cur) {
  //          break;
  //        }
  //      }
  //      if (i === -1) {
  //        i = 0;
  //      }
  //      $('.page-toc li a').removeClass('red');
  //      $('.page-toc li').eq(i).children('a').addClass('red');
  //      let height = $('.page-toc li').eq(i).position().top-$('.page-toc').height(); // 如果当前的offset出去了 回到中间可好？
  //      $('.page-toc').scrollTop(height+$('.page-toc').height()/2);
  //    },200)
  //   }

  //   $('.content').on('scroll', dark);
  // }
</script>
<style>

    /* ::-webkit-scrollbar{width:14px;}
    ::-webkit-scrollbar-track{background-color:transparent;}
    ::-webkit-scrollbar-thumb{background-color:transparent;}
    ::-webkit-scrollbar-thumb:hover {background-color:transparent}
    ::-webkit-scrollbar-thumb:active {background-color:transparent} */

    .page-toc > ul .red {
        background: #f3f3f3;
        z-index: 1;
        border-left: 3px solid #009a61;
        -webkit-transition: all .2s ease;
        transition: all .2s ease;
        color: #000
    }





</style>
</body>
</html>
